Skip to content

Fix/batch verify returns failed ids - #606

Open
AbuJulaybeeb wants to merge 3 commits into
Iris-IV:mainfrom
AbuJulaybeeb:fix/batch-verify-returns-failed-ids
Open

Fix/batch verify returns failed ids#606
AbuJulaybeeb wants to merge 3 commits into
Iris-IV:mainfrom
AbuJulaybeeb:fix/batch-verify-returns-failed-ids

Conversation

@AbuJulaybeeb

Copy link
Copy Markdown

This PR resolves #458 by updating the return signature of verify_campaigns.

Problem: Previously, verify_campaigns captured the first error it encountered but continued processing the batch. At the end, it returned the first error, which would cause the entire transaction to revert, discarding all successful verifications in that batch (wasting gas) and leaving callers with no way to identify which specific campaigns failed or succeeded.

Changes Included:

src/lib.rs: Updated verify_campaigns to return Result<(Vec, Vec), Error>. It now collects successfully verified IDs and failed IDs into separate vectors and returns them.
src/tests/test_voting.rs & src/tests/test_lifecycle.rs: Updated test assertions to expect the new (verified_ids, failed_ids) return type instead of erroring out on partial batch failures.
Acceptance Criteria Verified:

verify_campaigns now returns a tuple of (verified_ids, failed_ids).
Callers can now inspect precisely which campaigns failed verification.
Tests have been updated and validated.
Linked issue correctly.
How to Test:

bash
cargo test

closes #458

@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@AbuJulaybeeb Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@davidmaronio davidmaronio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the core of this is solid. the (verified_ids, failed_ids) tuple matches what #442 asked for, the partial-failure test with the nonexistent id 999 in test_voting.rs:370 is exactly the right coverage, and dropping the revert-on-first-error behavior fixes the wasted-gas problem described in the issue.

blockers before merge:

  1. this branch is stacked on #605, so it silently carries all of that pr's unrelated changes: the CategoryMaxGoalCap feature in src/admin.rs:536, src/storage.rs:82, and src/lib.rs:361 (which nothing enforces), plus the update_campaign_description change in src/campaigns/update.rs:63. please rebase onto main so this pr only contains the verify_campaigns change and its tests.
  2. src/lib.rs:255 - the campaigns_bulk_verified event still publishes (verified, total). since callers of the event stream can't see failures either, consider including failed_ids.len() in the payload and updating EVENT_PAYLOADS.md (that's what #720 does for the same issue).
  3. fyi #720 is an open duplicate of this. worth coordinating on which one lands, since the return-type change is breaking for any existing caller and only one can merge.

@AbuJulaybeeb
AbuJulaybeeb force-pushed the fix/batch-verify-returns-failed-ids branch 5 times, most recently from e70192b to 3fff301 Compare August 4, 2026 14:15
@davidmaronio

Copy link
Copy Markdown
Contributor

this is still stacked on #605, the diff carries update.rs and contributions.rs including the duplicated token transfer that is failing ci on both branches. the ask from the last review stands: rebase onto main so this pr is only the verify_campaigns tuple change, its tests, and the event payload update. happy to re-review right after.

@AbuJulaybeeb
AbuJulaybeeb force-pushed the fix/batch-verify-returns-failed-ids branch 2 times, most recently from 9152a27 to bdd9fe6 Compare August 4, 2026 15:32
@AbuJulaybeeb
AbuJulaybeeb force-pushed the fix/batch-verify-returns-failed-ids branch from 81f4cb6 to 8f39166 Compare August 4, 2026 15:44
@AbuJulaybeeb

Copy link
Copy Markdown
Author

this is still stacked on #605, the diff carries update.rs and contributions.rs including the duplicated token transfer that is failing ci on both branches. the ask from the last review stands: rebase onto main so this pr is only the verify_campaigns tuple change, its tests, and the event payload update. happy to re-review right after.

fixed please merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] verify_campaigns batch silently skips failures — callers cannot tell which campaigns were not verified

2 participants